/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package digitaldreamers.games.ddmonsters.servers.gameserver.network.packets.sending;

import digitaldreamers.libraries.games.servers.networkmanagement.packets.sending.AbSendablePacket;
import digitaldreamers.games.ddmonsters.servers.gameserver.components.RoomComponent;
import digitaldreamers.games.ddmonsters.servers.gameserver.configurations.Configuration;
import java.io.DataOutputStream;
import java.io.IOException;

/**
 *
 * @author DaoLe
 */
public class SJoinRoomRequestResponse extends AbSendablePacket {
    private boolean m_bIsOK;
    private RoomComponent m_Room;

    public SJoinRoomRequestResponse(boolean bIsOK, RoomComponent room) {
        m_bIsOK = bIsOK;
        m_Room = room;
        mPacketId = Configuration.JOIN_ROOM_REQUEST_RESPONSE_ID;
    }

    @Override
    public void writeData(DataOutputStream DOS) throws IOException {
        DOS.writeInt(mPacketId);
        DOS.writeBoolean(m_bIsOK);
        if(m_bIsOK) {
           // DOS.writeInt(m_Room.getRoomRule().getRule());
            DOS.writeUTF(m_Room.getRoomMaster().getPlayerInformation().getLogin());
            //DOS.writeInt(m_Room.getRoomMaster().getLevel());
            DOS.writeInt(m_Room.getRoomMaster().getPlayerInformation().getWin());
            DOS.writeInt(m_Room.getRoomMaster().getPlayerInformation().getLoss());
        }
    }
}
